package Dao

func Get_details() (error, []Order_details, int64) {
	var detailsdate []Order_details
	var total int64

	err := Db.Table("order_details").Order("order_details_id").Count(&total).Find(&detailsdate).Error
	return err, detailsdate, total
}

func Add_details(details Order_details) (error) {
	err := Db.Table("order_details").Select("order_details_id","order_id","goods_id","order_details_number","factory_id","order_sum_money","is_del").Create(&details).Error
	return err
}

func Update_details(details Order_details)(error){
	err := Db.Table("order_details").Where("order_id = ?", details.Order_id).Updates(&details).Error
	return err
}

func Delete_details(id string)(error) {
	var details []Order_details
	err := Db.Table("order_details").Where("order_id = ?", id).Delete(&details).Error
	return err
}
